package com.diandian.backend.entrance.client;

import com.diandian.backend.entrance.client.dto.dingding.DingdingMessageSendParamDTO;
import com.diandian.backend.entrance.client.dto.dingding.OapiV2DepartmentListsubResponse;
import com.diandian.base.boot.starter.response.BaseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient("diandian-dingding-exchange")
//@FeignClient(value = "business-diandian-dingding-exchange", url = "http://localhost:10006", path = "")
public interface DianDianDingDingExchangeClient {

    /**
     * 根据部门ID获取部门详情
     */
    @GetMapping("/dept/getByDeptId")
    Object getByDeptId(@RequestHeader(value = "appKey") String appKey,
                       @RequestHeader(value = "appSecret") String appSecret,
                       @RequestParam(value = "dingDeptId") Long dingDeptId) throws Exception;

    /**
     * 发送钉钉消息
     */
    @PostMapping("/message/send/text")
    BaseResult sendText(@RequestHeader(value = "appKey") String appKey,
                       @RequestHeader(value = "appSecret") String appSecret,
                       @RequestBody DingdingMessageSendParamDTO data);

    /**
     * 获取token
     */
    @GetMapping("/token/get")
    BaseResult getToken(@RequestHeader(value = "appKey") String appKey,
                        @RequestHeader(value = "appSecret") String appSecret) throws Exception;

    /**
     * 根据用户ID获取用户信息
     */
    @GetMapping("/user/getUserInfoByUserId")
    Object getUserInfoByUserId(@RequestHeader(value = "appKey") String appKey,
                               @RequestHeader(value = "appSecret") String appSecret,
                               @RequestParam(value = "dingUserId") String dingUserId) throws Exception;

    /**
     * 根据手机号获取用户信息
     */
    @GetMapping("/user/getUserInfoByMobile")
    Object getByMobile(@RequestHeader(value = "appKey") String appKey,
                       @RequestHeader(value = "appSecret") String appSecret,
                       @RequestParam(value = "mobile") String mobile) throws Exception;

    /**
     * 获取部门列表
     * @param dingDeptId
     * @return
     */
    @GetMapping("/dept/getDeptList")
    OapiV2DepartmentListsubResponse getDeptList(@RequestHeader(value = "appKey") String appKey,
                                                @RequestHeader(value = "appSecret") String appSecret,
                                                @RequestParam(value = "dingDeptId") Long dingDeptId,
                                                @RequestParam(value = "language") String language);
    /**
     * 获取部门用户详情(全部）
     */
    @GetMapping("/user/getAllDeptUserDetail")
    BaseResult getAllDeptUserDetail(@RequestHeader(value = "appKey") String appKey,
                                    @RequestHeader(value = "appSecret") String appSecret,
                                    @RequestParam(value = "dingDeptId") Long dingDeptId,
                                    @RequestParam(value = "orderField", required = false) String orderField,
                                    @RequestParam(value = "containAccessLimit", required = false) Boolean containAccessLimit,
                                    @RequestParam(value = "language", required = false) String language);
}
